# Nebojsa Trninic, Novi Sad, 29.09.2012.

#$(CXX) $(CXXFLAGS) $(CPPFLAGS) <DEPENDENCIES> -o <TARGET>

PREFIX = ../bin/
TARGETS = $(PREFIX)ibc.o $(PREFIX)ibctest $(PREFIX)ibcnettest TAGS $(PREFIX)fcli $(PREFIX)fsrv

CXX = g++
OMNITHREAD_LIB = -lomnithread
CXXFLAGS =  -g


.PHONY : all
all : $(TARGETS) 

.PHONY : clean
clean :
	rm -f $(TARGETS) doc/intgr.aux doc/intgr.bbl doc/intgr.blg doc/intgr.log doc/intgr.out doc/intgr.pdf

.PHONY : backup
backup :
	tar czvf ../backup/`date +%Y_%m%d_%H%M%S`.tar.gz *

.PHONY : TAGS
TAGS :
	etags *.cpp ./*/*/*.c

$(PREFIX)ibc.o: ibc.h ibc.cpp
	$(CXX) $(CXXFLAGS) $(filter-out %.h, $^) -c -o $@

$(PREFIX)ibctest: $(PREFIX)ibc.o m.cpp
	$(CXX) $(CXXFLAGS) $^ -o $@ $(OMNITHREAD_LIB)

$(PREFIX)ibcnettest: $(PREFIX)ibc.o cli.cpp
	$(CXX) $(CXXFLAGS) $^ -o $@ $(OMNITHREAD_LIB)

$(PREFIX)fcli : ./ex_beej/float/idl.h ./ex_beej/float/fcli.c
	$(CXX) $(CXXFLAGS) $(filter-out %.h, $^) -o $@ $(OMNITHREAD_LIB)

$(PREFIX)fsrv : ./ex_beej/float/idl.h ./ex_beej/float/fsrv.c
	$(CXX) $(CXXFLAGS) $(filter-out %.h, $^) -o $@ $(OMNITHREAD_LIB)

.PHONY : doc
doc:
	cd doc; pdflatex intgr.tex; bibtex intgr.aux; pdflatex intgr.tex; pdflatex intgr.tex; cd ..

